package cn.com.roy.thread.t4_1_11.lockmethdtest1;

import cn.com.roy.thread.t4_1_2.conditiontestmoremethod.ThreadA;

public class Run {
    public static void main(String[] args) {
        try {
            final MyService service = new MyService();
            Runnable runnable = new Runnable() {
                public void run() {
                    service.waitMethod();
                }
            };
            Thread ta = new Thread(runnable);
            ta.start();
            Thread.sleep(500);

            Thread tb = new Thread(runnable);
            tb.start();
            Thread.sleep(500);

            System.out.println(service.lock.hasQueuedThread(ta)); //查询指定的线程是否在等待此锁定
            System.out.println(service.lock.hasQueuedThread(tb));
            System.out.println(service.lock.hasQueuedThreads());//查询是否有线程等待此锁定


        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
